<template>
  <div>
    <div v-for="(ele,index) in list" :key="index">
      <el-menu-item :index="ele.path" v-if="ele.children.length<=0 || ele.children == null" @click="goRouter(ele.path)">
        {{ele.name}}
      </el-menu-item>
      <el-submenu :index="ele.path" v-if="ele.children && ele.children.length">
          <template slot="title">{{ele.name}}</template>
          <menu-tree :list="ele.children" :path="ele.path"></menu-tree>
      </el-submenu>
    </div>

  </div>
</template>

<script>
  export default {
    name: "menu-tree",
    props: ['list', 'path'],
    data() {
      return {

      }
    },
    methods: {
      goRouter(p,item) {
      console.log(this.$router);
      this.$router.push({ path: p });
    }
    },
  }
</script>
<style scoped>

</style>